Added dynamic pattern generation.