got undo function working