refactoring for stage injection