Completed implementation of Rains' generator search, and some fixes.

Wow! That's SOME performance!
Stupid bug fix