 path = require 'path'
 
 class Exprestive
+
   constructor: (baseDir, @options = {}) ->
-    @appDir             = path.resolve baseDir, @options.appDir ? ''
-    @routesFilePath     = path.resolve @appDir, @options.routesFilePath ? 'routes'
+
+    # The directory where routes and controllers can be found
+    # Used only as a relative directory for @routesFilePath and @controllersDirPath
+    @appDir = path.resolve baseDir, @options.appDir ? ''
+
+    # Path to the routes file
+    @routesFilePath = path.resolve @appDir, @options.routesFilePath ? 'routes'
+
+    # Path to the directory to look for controllers
     @controllersDirPath = path.resolve @appDir, @options.controllersDirPath ? 'controllers'
+
+    # Router to register routes and pass to express as middleware
     @middlewareRouter = express.Router()
 
 
-  # Registers a route on the middlewareRouter
+  # Registers a route on @middlewareRouter
   addRoute: ({ httpMethod, url, controllerName, controllerAction }) ->
-    httpMethod = httpMethod.toLowerCase()
-    @middlewareRouter[httpMethod] url, => @controllers[camelCase controllerName][controllerAction] arguments...
+    @middlewareRouter[httpMethod.toLowerCase()] url, =>
+      @controllers[camelCase controllerName][controllerAction] arguments...
 
 
-  # Returns a hash of methods (GET, POST, PUT, DELETE) to be called in the routes file
+  # Returns the hash of methods passed to the routes file function
   getRoutesHelperMethods: ->
     helperMethods = {}
     for httpMethod in ['GET', 'POST', 'PUT', 'DELETE']

      @controllers[controllerName] = new Controller


  initializeRoutes: ->
    return if @routesInitialized
    @routesInitialized = yes

    @middlewareRouter


  # Populates @controllers by instantiating controllers found in @controllerDirPath
  initializeControllers: ->
    @controllers = @options.controllers ? {}
    return if @options.controllers?
