Continued debug in header creation

Changed filewrite order and print order