Translation: refactored to use dependency injection.