pulling note-add-db.js out of main.js. a few other notes and small reorganizing.