CLEARWATER SCTX-1334: dup pull-reqs #1062 #1199

A Clearwater duplicate of pull-request #1199 which fixed SCTX-1334.

The changes in #1199 require the changes made in #1062 so I have included those changes here as well.