refactored to use abstract thread implementations