minor refactoring; for some strange reason this test keeps failing on jenkins