code improvements, using urllib2, bug fixes