Move common env code into methods