Rebase PR #1

This is a rebase of PR #1 in the hope of merging it eventually.