Build environment object

**Summary**

* Build out an object representing the environment
* Replace all parsing code to use the new object.