Cleanup and add environment settiing argument to spawnProcess (OMS-205)