Changed local variable names from tmp2 & tmp2 to header & value to clarify code