refactored the header computation to not use a map anymore