a lot of changes to deal with changing ipython api, fun fun fun fun