Code-cleaning before thread implementation