changed rtol to 1e-8 and saved some memory by avoiding np.abs