environment refactoring