tried to speed things up with comment outvars. Failed but added in comments. Changed some 1/x to np.reciprocal