some refactoring; start on summary data