got a lot of the way there on refactoring.  Missing some edge cases -> most likely will need to combine group and project expressions so that they can be merged when necessary.
temp