implemented the delete method