pulling out code that generates the record header