add migrations, models and refactoring