Moved environemnt-specific functionality to new environment.py