A more principled handling of the environment.