Updated some utililty functions and tests for gh-438