Added main header write