Fixed clean function