Improve min/max recursion