Refactored thread.