refactoring migration handling for code climate