 
 # Filter out dotfiles, emacs swap files and directories.
 exports.filterFiles = (files, sourcePath) ->
-  re = /^(\.|#)/
   files.filter (filename) ->
-    return no if re.test filename
+    return no if (exports.Watcher::invalid).test filename
     stats = fs.statSync path.join sourcePath, filename
     return no if stats?.isDirectory()
     yes

    @_watch directory, read

  _handle: (file) ->
    fs.realpath file, (error, filePath) =>
      return exports.logError error if error?
      fs.stat file, (error, stats) =>



class exports.Watcher extends EventEmitter
  # RegExp that would filter invalid files (dotfiles, emacs caches etc).
  invalid: /^(\.|#)/

  constructor: ->
    #console.log "Created"
    @watched = {}
