added funtions redo and undo