Added variables required for an undo function as well as the function and modifications to move