 
 casper.run ->
   @echo "Completed #{executed}/#{ARGS[2]} quer#{if executed is 1 then 'y' else 'ies'}."
-  if facebookLogin # if there was an offer to log in with a facebook account
+  if facebook # if there was an offer to log in with a facebook account
     @echo 'Earn more points by linking your Facebook account (not done through bot).'
   @exit executed - ARGS[2] # exit with code (-failed)
    userAgent: hexBot.userAgent
)
DASHBOARD = 'http://www.bing.com/rewards/dashboard'
offers = []; executed = 0; facebookLogin = false

argData = [{name:'email'}, {name:'password'}, {name:'queryCount',default:0},
           {name:'minTime',default:20}, {name:'maxTime',default:40}]

        # remainingQueries = queriesPerPoint * remainingPoints / earnedPerQueries
        queryCount = Math.ceil(per * (upTo - soFar) / earn)
      else if title is 'Connect to Facebook'
        facebook = true # free points by logging in with facebook
      else if title not in ['Refer a Friend', 'Bing Newsletter']
        offers.push elem.href # add the link of the offer
    return [offers, queryCount, facebook]
  ), offers, ARGS[2], facebook

casper.then openDailyOffers = ->
  @each offers, (self, offer) -> # iterate over offers
