Improve .done style, remove unused functions in db.js