Added database.js, needs some testing