Debugged code.

Fixed issues relating to each_type, pairs, num_val, and runs.
Glaring issues found and rooted out so that later runs will
not require finding these hidden problems.