following http://chimera.labs.oreilly.com/books/1234000000754