Fixed ipython embedding and enabled ipdb for better debugging
Slight cleanup of embedding code