(Some typos in error messages and comments.)
Added missing copyright headers.