refactoring and migrations