removed all references to header.type in function calls to see if we can just find the global variable