Made the cleaning process recursive