Implement cleaner algorithm.