Implemented dependency injection.