Again many thanks for your advice!

I've added the mentioned changes and filed a pull request here. There still are some caveats, but it seems easier for me to comment on the according lines through the Github UI.