Added database functions for fetching contacts