Refactoring
Reuse thread ids
Small fix