refactor PatternBuilder and dsl