Ch 11

Some improvements and fixes, please see commit history.