console output added
Refactoring in db.js