refactoring and unifying import and migration