Added number of threads as config parameter