refactor the code so when single threaded execution is requested, no new processes are crearedk