Cleaned up code, finished IPython notebook.