Converted class to use dependency injection