Added functions to interact with the database.