completed SetupEnv and made minor changes to existing env functions