Fix for #77.
Some code cleanup in the url processing function.