Merged Pull Request #484

This is a modified version of #484 that should merge cleanly.