Structured header and footer

Make generic header and footer so that changes only have to be
made once.