Write the function `trimHeader` more beautifully