Removed envi as a global variable. It is now a parameter for extensions.