added a generator for patterns