getEnvironments() improvements