refactored models and migrations