move building the container header

move it to its own method