added a reset function to undo all changes