Added in initial work on aggregating loops