Refactored database specifics out of API. Clean-up from overall refactor