fixed header script writing to itself
some more edits on the scripts output