refactor Facade, Singleton and Template patterns