tidied up header checking