added code for dependency injection