added max function to arrays