add Singleton pattern and Factory pattern