Migrations

Code review for migrations branch needed before merge.