Need to review the code to see where some of the functions can be optimized. Specifically around aggregation methods.