Projectkk2glider/issue 1783 for master

Closes #1783

Please review carefully, I am not so sure I did everything correctly. After (if) this is merged, I will prepare pull request against `next`.