make num_threads a kwarg