revert changes and delete function