fixed pointer use of the header object + code cleanup.