refactored, started db work