FindMin and FindMax functions implemented.