Changed some code in Algorithms.