Added headers, corrected a few problems