Added changelog script.

Moved declarations so that error-handling gotos do not skip them.

Converted int -> size_t where approporiate.

Corrected some typos.