Abstract max and min, maxWith and minWith to helpers

Obviously slight (probably inlined function call) perf hit but it's going to be much better than it was last revision.