Added min of min & min of max optimizations