reformat code
add new functions for agg name