split basalutil.js into segmentutil.js and basalutil.js
expand test suite to cover ensure circumstances where there's not enough data to calculate a stat return some form of NaN