Rewritten for IPython Notebook