fixed aggregation variable collision. reduced redundant calcs