Simplified the ridiculous interation between dialogs, fixed a TODO so that the graph is only cleared when necessary, and made some wee cleanups.