Updated code (ran on Anaconda)

Hey, I couldn't run your script on either Python 3.4 or 2.7, so I ran Anaconda and fixed it up. Works fine for me now. Thanks a bunch for this code!