Added dependency injection to design patterns