I should probably update this so an invalid header (one with an empty value) doesn't get written. What do you think?