Generalized the thread class