added env line and fixed casting problems with number of threads variable
created a better named arg, cores to threads