Pull request for #260

Additional test coverage and an implementation change that should be reviewed.