tidied some code around the header hash