max function not needed