Updated y min/max search

The search now can deal with there being a variety of y variables rather
than expecting exactly two.