Move helper functions to utils.
Reflect last change in tests.