Changed cleaning function