Moving exit step to environment variable flag