Changes for retrieving a contact from db - thanks to roberto