Array max function added which returns the index of max score