need a hint, how I can do the requested changes
v3 should address all comments
v2 of the patch with comments from Christophe Giboudeaux considered