refactored for dependency injection