Setting the Cleaning Function