added and tested undo feature