refactors env calls out of wrapper.