Code now works using IPython parallel