Split environment into pure and impure parts
Rename a bunch of things