Algorithm cleaning