Remove unnecessary threads