Made some minor tweaks to readHeader