Added 'undo' moves using a stack, minor clean ups