Added a set of helpers and refactorings to tests.