Started writing the algorithm.