refactoring optional ref tests