Merge Cavia back to master?

This contains a number of recent changes and improvements.