Categorisation refactor optimizer with multi thread