Use max() instead of for loop