Merge integration branch for #41

Bors integration pull-request for #41 which cannot be automatically merged. See #41 for full code review/discussion.