Thread class refactoring