You can try my improved version in the comments: https://gist.github.com/rudolfschmidt/b79b7864bac19cc7148edf...
Reply on news.ycombinator.com