Updated "migrate" command, small improvements, updated tests