Incorporate accidentally lost recent changes.

This fork was based on an outdated version. This brings it up to date.