created clouser arund delete function