implemented delete function