Environment refactoring