For ENG-5079, Further refactoring to make test code work