Rework how env is used