Fixed script so that people can run independent of IPython notebook.