Rewrite so it doesn't directly manipulate the environment variables of the current process, just the ones it spawns