Added core detection and a thread optimization param.