added code to display pattern, ugly but i needed a working example first