refactoring in metatest code