add pattern struct, better demo