Minor fixes/improvements here and there (see descriptions of individual commits).

(this pull request also resolves #1 and #2)