began to create the cleaning funciton