implemented undo and redo
fixed merge in mouseListener