Parse the header in a single function