Cool stuff, although, there's a fair bit of imperative code in there that
probably isn't idiomatic - I applaud the effort thought as I also went
looking for a scala abstraction and ended up writing my own (internal only,
so cant share it).
If I get time i'll take a look and see if I can help out :-)