Thanks! Proposed solution is available [here](http://www.facebook.com/l.php?u=https%3A%2F%2Fgist.github.com%2Ftkurylek%2F8c3f8bc51bdf2a92f5f5&h=EAQEq5-6X).