Fix the code to remove trailing dots

And make it easier to understand as well.
Update the list of new gTLDs