Updated to find the minimum or max...