More robust header treatment and ignoring footer