Initial license headers, code documentation and code style changes

Initial license headers
Updated code documentation in several places
Minor code style changes