marking now uses database; some consolidation of code; tweak to javascript functions