implementation of the delete method