add pattern generation