Refactored Database API and Data types