Added functions to return data from the database