More unit tests, helper functions for aggregations