Refactoring test thread