Refactored utilities as part of adding an integration test.