refactored all the things and made the db into a legit class

turns out singletons are a pain in the ass to test.
unit testing for all!