Extract header and footer