Refactoring how the db api is exposed