Working version.

Correctly clones, configures and runs environment. Resources
are all appropriately cleaned up on exit.

Staging in of resources is not yet tested.