cleaned up move function