 module.exports = parsers.create
   name: 'gsc'
   processes: [
-    ->
-      promises = []
-      promises.push(fetchPage(pageCode)) for pageCode in pageCodes
+    -> # fetch the list of flavor ingredient pages to query
+      fetched = p.defer()
 
-      p.all promises
-    , (pages) ->
-      # merge pages back into a single array
-      components = []
-      components = components.concat.apply components, pages
+      request baseUri
+      .then (doc) ->
+        $ = cheerio.load doc
 
-      console.log "found #{components.length} components in total"
+        mapHrefs = (i, v) ->
+          # todo: cleaner way of skipping the 'href="#"'
+          href = $(v).attr('href').trim().replace('#', '')
+          if href is '' then null else href
+
+        # tab index 15 is "flonly-" or Flavor Ingredients
+        fetched.resolve $($('div.tabs').get(15)).find('li').find('a').map(mapHrefs).get()
+        #fetched.resolve ['http://www.thegoodscentscompany.com/flonly-d.htm']
+      .catch (err) ->
+        console.error err
+        fetched.reject err
+
+      fetched.promise
+    , (uris) -> # create a promise to fetch each page of ingredients
+      pageQueue.totalRequests = uris.length
 
       promises = []
-      promises.push(fetchDetails(component, components.length)) for component in components
+      promises.push(fetchPage(uri)) for uri in uris
 
       p.allSettled promises
       .then (results) ->
-        # cull any failed promises
+        # cull any broken promises
+        results
+          .filter (v) -> v.state is 'fulfilled'
+          .map (v) -> v.value
+    , (pages) -> # create a promise to fetch details for each ingredient
+      # first, merge pages of ingredients back into a single array
+      ingredients = []
+      ingredients = ingredients.concat.apply ingredients, pages
+
+      console.log "found #{ingredients.length} ingredients in total"
+
+      promises = []
+      promises.push(fetchDetails(ingredient, ingredients.length)) for ingredient in ingredients
+
+      p.allSettled promises
+      .then (results) ->
+        # cull any broken promises
         results
           .filter (v) -> v.state is 'fulfilled'
           .map (v) -> v.value

        name: $('td.prodname').text().trim()
        notes: $('.fotq').text().trim()
        synonyms: $('#rhtable tr[itemscope]').map(mapSynonyms).get()
        data: data

      # todo: look up flavors if a demo link is provided
      #demoUri = $('.demstrafrm').find('a').attr('href')

      fetched.resolve merge(component, details)
    .catch (err) -> fetched.reject err

  fetched.promise


  fetched.promise

fetchDetails = (ingredient, ingredientCount) ->
  fetched = p.defer()

  ingredientQueue.totalRequests = ingredientCount
  ingredientQueue.queue ->
    request "#{baseUri}/data/#{ingredient.id}.html"
    .then (doc) ->
      $ = cheerio.load doc
      console.log "parsing details for #{ingredient.name}"

      # try and parse the label for this row into a hashable key
      data = {}
