Db fixes

Support both direct DB connections and connections via fh.db

Make files more modular.
not a reason to stop the merge, but would be nicer if we had mocking and/or spying closer to the tests that use them.
e.g. http://sinonjs.org/ (similar to how jasmine does mocking & spying)