refactoring for di container usage