change environment detection method to a closure