Some work for Issue #4 and issue #29 [see issue comments]