Has code added to write header. Moved local defines to header.