added some comments to database.js