some refactoring in patternmodeller (templated function), adding querier