added another alternative for working with aggregates