Mostly functional database.

Need to add some more helper methods and all of the getters.