   "../lib/local-storage/LocalStorage",
   "../lib/dojox/uuid/generateTimeBasedUuid"
 ], (LocalStorage, makeUuid) ->
-  class FileSystem
+  class FileSystem # Implements a simple filesystem on top of LocalStorage.
     constructor: ->
-      if not localStorage?
+      if not localStorage? # Make sure Web Storage is available.
         errMsg = "CoffeeScript OS requires Web Storage. Please try again using Chrome > 4.0, Safari > 4.0, IE > 8.0, Firefox > 3.5, or Opera > 11.5"
-        alert errMsg
-        throw new Error errMsg + "."
-      @store = new LocalStorage {
+        alert errMsg + "."
+        throw new Error errMsg
+      @store = new LocalStorage { # Create an instance of LocalStorage for our own private use.
         idProperty: "loc"
       }
       @handles = []
       @dirExp = new RegExp "\.dir$"
 
-    getNextId = ->
-      id = @store.get(0).contents
-      id = 1 if not id?
-      @store.put {contents: id, loc: "/.nextInode"}
-      return id
-
     createFile: (dir, name, contents, acl) ->
       inDir = @store.query {
-        dir: dir
+        loc: dir + ".dir"
       }
       if inDir[0]?
         if contents?

        dir: dir
      }
      contents = []
      contents.push {name: file.name, meta: file.meta} for file in files when file.name isnt ".dirExists" and not file.name.matches(@dirExp)?
      contents.push {name: dir.name, meta: {type: "dir"}} for dir in files when dir.name.matches(@dirExp)?
      return contents

    open: (dir, name) ->
      handle = makeUuid @node
      file = @store.query {
        path: dir + "/" + name
        dir: dir
        name: name
      }
      if file?
        handles[handle] = file
        return handle
      else
        return null

    flush: (handle) ->
      @store.put handles[handle]

    close: (handle) ->
      flush handle
      delete handles[handle]

  return FileSystem

    createDir: (dir, name) ->
      path = dir + "/" + name
      @store.add {
        loc: path + ".dir"
        dir: dir
        name: name + ".dir"
