Added code to get the header and footer from pg files