ref #9932 improve parsing of subgeneric names and some refactoring