Refactor minor issues.
Add missing copyright headers.