Implementation off the delete function