Moved env to its own method