updated: Ability to specify number of threads.