For ENG-5869, based on John's feedback add comments and factor out copy pasta code