Create migrate-lib as requested by Zane.
restructure code for migrate-lib