moved thread generation to separate function to avoid goto
added two new tools
Merge ../bachelor