delete function working like a charm