Added support for dependency injection.