New function.
Remove obsolete code, add threads by classes support in main func.