Breaking the database functions out into a package as well as some utility functions.