changes to Max's migrate script