Can you also give more detailed information of the chain of events that take place in this function? It's doing more than just grouping by year.