Nice use of inject. I wonder if it's possible to do this in a single pass?