Tweaked NathanKell's pull request.