Refactored environments to use declarations