Large progress on migration.
Rewrote comments on upgrade, migration helper functions.
Wrote test for migration.