Updated Pull Request #965

Due to my failure in not being able to rebase #965 I have created a new pull request on a new branch.

Fixes #962