refactoring the NameOptScoreQuery class