break the ymin/ymax logic out into one method

small unimportant refactor.  The tests were in place, so I took the opportunity to remove the logic duplication when determining the ymax and the ymin.