preaggregation refactor, test