Better thread cleaning