refactoring of threading classes
minor code improvements