Clean up and improve the interactive console

This is #830