url-fix refactored

I've refactored my last fix. I hope this will be better readable and summarized.

Could you please push the new version to the npm-repository as soon as possible ?

Thank you and great work !