	private void updateCallLogForContact(Context context, Contact contact, String number) {
		Uri allCalls = Uri.parse("content://call_log/calls");
		Log.d("Contact", "Looking up :"+contact.name+ " with number: "+number);
		Cursor c = context.getContentResolver().query(allCalls, 
        		new String[] {CallLog.Calls.NUMBER, CallLog.Calls.DATE, CallLog.Calls.TYPE, CallLog.Calls.DURATION, "normalized_number"},
        		null, null, null);
        if (c.moveToFirst()) {
           do {
               String num = c.getString(c.getColumnIndex(CallLog.Calls.NUMBER));
               long timestamp  = Long.parseLong(c.getString(c.getColumnIndex(CallLog.Calls.DATE)));
               int type = Integer.parseInt(c.getString(c.getColumnIndex(CallLog.Calls.TYPE)));
               int duration = Integer.parseInt(c.getString(c.getColumnIndex(CallLog.Calls.DURATION)));
               final int CALL_DURATION_THRESH = 1;
               if (duration >= CALL_DURATION_THRESH && type != CallLog.Calls.MISSED_TYPE) {
	               ContactEvent event = new ContactEvent();
	               event.type = TYPE.CALL;
	               event.timestamp = timestamp;
	               event.callType = type;
	               event.number = num;
	               contact.contactEvents.add(event);
	               if (event.timestamp > contact.lastcontact) {
	            	   contact.lastcontact = event.timestamp;
	               }
               }
           } while (c.moveToNext());
        }	
	}

	private void updateCallLogForContact(Context context, Contact contact, String number) {
		if (number == null) return; 
		Uri allCalls = Uri.parse("content://call_log/calls");
		Log.d("Contact", "Looking up :"+contact.name+ " with number: "+number);
		Cursor c = context.getContentResolver().query(allCalls, 
        		new String[] {CallLog.Calls.NUMBER, CallLog.Calls.DATE, CallLog.Calls.TYPE, CallLog.Calls.DURATION, "normalized_number"},
        		"normalized_number = ?", new String[] {number}, null);
        if (c.moveToFirst()) {
           do {
               String num = c.getString(c.getColumnIndex(CallLog.Calls.NUMBER));
               long timestamp  = Long.parseLong(c.getString(c.getColumnIndex(CallLog.Calls.DATE)));
               int type = Integer.parseInt(c.getString(c.getColumnIndex(CallLog.Calls.TYPE)));
               int duration = Integer.parseInt(c.getString(c.getColumnIndex(CallLog.Calls.DURATION)));
               final int CALL_DURATION_THRESH = 1;
               if (duration >= CALL_DURATION_THRESH && type != CallLog.Calls.MISSED_TYPE) {
	               ContactEvent event = new ContactEvent();
	               event.type = TYPE.CALL;
	               event.timestamp = timestamp;
	               event.callType = type;
	               event.number = num;
	               contact.contactEvents.add(event);
	               if (event.timestamp > contact.lastcontact) {
	            	   contact.lastcontact = event.timestamp;
	               }
               }
           } while (c.moveToNext());
        }	
	}
