Changes to implement factory, adapter, singleton

Added methods to meet requirements.