refactoring, update, and cleanup of API and database stuff