added pattern generation