corrected algorithms
optimized algorithms