it is identical but I think my solution is more expressive and easier to understand:

http://goo.gl/STfg8o