Adding database functions