Pr 434 branch copy

This is a copy of the branch in PR #434, which I've since deleted. Sending this new PR to replace it so I can make the changes here.