adding an undo button, general button logic