Refactor dependency injection.