cleaned up and simplified; added name export for .dot files