Merge integration branch for #37

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