Generalized specification of max number of threads to use; fixed issue with mapper