amended database.js