db.js moved for general purposes