Refactored thread rests methods into own class.

Did the same for thread functional / unit tests.