Dependency injection refactor