Manually merging in changes from PR #160