env change and refactoring