Finished Damm's Algorithm.