refactored if condition in solution loop.  A bit more readable, and doesn't seem to affect performance much.