completed the delete function