Many changes from upstream, and improved CI setup.