code cleanup, moved LogWriter to tools
added diagrams