added parameter to exclude urls already loaded
tweaked code