refactored
implemented factory pattern for aggregate expressions