Moved database class to database.js; Moved some utility functions to utils.js;