[Here](https://gist.github.com/ubernostrum/9740951) is an example of a probably-better way of pulling all this stuff.