Un-revert PR #530

This reverts commit 68c71ec48f16eac6f8aff2a66496afb148ec95c6.  It simply re-applies a93e1df919450377b6dab707552582fd604cd8cf.