refactor of thread tools