Fixed up possible issue in algorithm.
Reduced some more stuff.