finished clean function