     watcher.on "add", upload
     watcher.close()
 
-authenicateUser = (user, pass, remote, callback)->
+authenicateUser = (callback, conf = config)->
     ##Authenticating to make sure wherever you're writing to exists
-    authenticate user, pass, remote, (response)->
+    authenticate conf.user, conf.pass, conf.remote, (response)->
         if !response.token
             console.error color(response.message, "red+bold")
             die()
         else
-            callback(response.token)
-
-# authenicateUser watch
+            callback(response.token, conf)
 
 
 exports.help = "Watch dir for changes and upload to sim"

    #Assume current author by default
    remote = "#{userName}/#{remote}"  if remote.indexOf('/') is -1

    console.log ""

    authenicateUser userName, pass, remote, (token)->
        watch(local, remote, token)

op = (require '../util/optionsParser')
uploader = (require "../util/upload")

config = {}

die = ()-> process.kill('SIGTERM')

watch = (token, conf = config)->
    console.log "Watching", color(conf.local, "white_bg+black") ,"for changes.."
    console.log ""

    watcher = chokidar.watch conf.local,
        ignored: (item) ->
            ignored_extensions = /\.(less|git|coffee|tmpl|DS_Store)/i
            ignored_directories = /node_modules/i
            ignored_files = /grunt.js|cakefile/i

            ignore = item.match(ignored_extensions) or item.match(ignored_directories) or item.match(ignored_files) or (conf.ignored and items.match(conf.ignored))
            # if ignore then console.log item, ignore
            return ignore

