Refactored container.
refactored code to use Instance::ensure()