Refactored the rest of the code to use list-based environments.