ENV logic added