added generateHeader function