slight refactoring of test code