Modified so that you can modify the resource.Other minor fixes.
Prototype implementation.