cleanup a few things
add header directive
handle unmatched strings