re #842 - Major refactor of the migration