Minor re-org of a util function. Added some new ones.

Issue: GCP-8800