curl replaced with urllib2, other improvements