Added missing license headers
More missing license headers.
Added XML doc, fixed some bugs.