Add code to save values for aggregate functions.