separate InitEnv from Main