interesting use of window functions and POROs to clean up n+1 queries