Updated the delete functionality