Completely rewrite migration, most of it is working now