preliminary code. generates pattern