       (product)-> entry.product = product
 
     resolveProducts = ->
+      oldProducts = products
+      products = []
       for own k, v of $location.search()
         v = parseInt(v)
         continue if isNaN(v)
-        entry = entryByProductName(k)
+
+        #update amount or add a new product if non-existent
+        entry = entryByProductName(oldProducts, k)
         if entry?
           entry.amount = v
+          products.push entry
         else
           Product.find(k).then delayedAddProduct(k, v)
+
       products
 
     resolveBuyer = ->

    buyer = null

    changeAmount = (entry, amount)->
      if entry.amount + amount < 1
        entry.amount = 1
      else if entry.amount + amount > entry.product.stock
        entry.amount = entry.product.stock
      else
        entry.amount += amount

    remove = (entry)->
      products.splice(products.indexOf(entry), 1)

    empty = ->
      searchObj = $location.search()


    isBuyable = -> products.length > 0 && exports.buyer

    entryByProductName = (entries, name)->
      return entry for entry in entries when entry.product.name == name
      null

    delayedAddProduct = (name, amount)->
