Add license headers and missing files.
A little bit of cleanup and formatting.