refactor building the dependency injection container