added threads as an option.