Refactored environment and configuration