Added some code to pattern2.c