max->np.max and PEP8 fixes