Hello,
I attach the third version of the previous patch, applying the suggestions made by Zeb, and some other changes that arose from them.
The patch is based on the master branch, but I guess I will have to update it if the recent patches from Giovanni are accepted, before sending it for review.
Best regards, Francisco.