Merge substantive changes from PR #386.