got rid of test for min = max