started with extracting ThreadHandler functionality into separate module