Refactor env.