Added closure example to detect environment.