added redo/undo functionality and clearing functionality