Moved environment handling to a separate EnvironmentRegistry

- Exit code 3 if autodetection fails
- Exit code 3 if environment is not installed