add controls to index page, create maindb, reorganize db abstractions