Re-factored code for delete method of set module