Migration refactoring