Added context for determining which environment the system is running in and whether or not the environment is Web or CLI.