A few tweaks to the inner loops, as a result of stepping through the code.
Add the toString() methods back.