Resubmitting pull request

Resubmitting pull request to new branch as a fix for #7