Good point. Makes things also easier.
I've had a shot at it, but wonder if there is a neater approach?
https://gist.github.com/kwirk/5491782