Ok, this solution to 9 is way more awesome (and more readable, really).

Ex 8 could probably be also changed to fit that, but I'll leave it to create some sort of history how my thinking changed.