converted class to use dependency injection