Changed max to np.max