extract the header and footer