Generates (most of the) header bytes