Refactored migration JS.