Flexible number of threads