Adding unit test from samuelgruetter to show the benefits of this PR.