Algorithms now work properly

Tested against solve_these.txt. Now getting same results for all
algorithms.