Updated findMin and findMax