Moved all db query functions from functions.php to sql_queries.php