very nice functional programming pattern, I like it