only iterate once to find max