refactor dependency injection update logic