Implementing dependency injection