Consolidated commit for #581

Resolves #557 

Changes by @co-dh consolidated into a single commit.