Move ENV guards to top of file