use generators for patterns