Ok :-)

Overly complicated and awfully non-declarative though

Cheers,
_