Updated logic for migration script. 
Now everything is working except factory order. (It will not work, I think)