cleaning up database.js