More refactoring, plus adding more data summary analysis.