function renamed; exception handling for urlopen added; encoding added