Makeshift undo function