Writes mkmove function. Needs unit testing.