Remove much of the duplication found in the tests