cleaning in db.js
add edit function
major update, code cleaning