Better generation of titles

With some help from Ivan Lazar Miljenovic, the author of GraphViz.