Optimized move function, except something about it doesn't work yet