Merge Phil's master with KiDS improvements.

This is mainly a test to get more experience with pull requests on github.