undo redo working, but needs some tweaking