More clever header parsing.