Simplify thread id implementation