some progress I think

Still ending up with an array of NaN for the averages.