Pattens sample code