Fixes #170

Implemented the discussed solution of #170.