Incorpoarting Mark Foltz changes from pull request #7.