Changes to delete function