finish the delete function