refactored retrieving object from container
refactored retrieving object from container and updated unit tests