better handling of headers