added support for maxThreads