make nThreads an optional attribute