refactoring settings and environments