refactoring
refactoring out thread control class