 // MARK: StaticFileServer
 
 public class StaticFileServer: RouterMiddleware {
-
-    //
-    // If a file is not found, the given extensions will be added to the file name and searched for. The first that exists will be served. Example: ['html', 'htm'].
-    //
-    private var possibleExtensions = [String]()
-
-    //
-    // Serve "index.html" files in response to a request on a directory.  Defaults to true.
-    //
-    private var serveIndexForDirectory = true
-
-    //
-    // Uses the file system's last modified value.  Defaults to true.
-    //
-    private var addLastModifiedHeader = true
-
-    //
-    // Value of max-age in Cache-Control header.  Defaults to 0.
-    //
-    private var maxAgeCacheControlHeader = 0
-
-    //
-    // Redirect to trailing "/" when the pathname is a dir. Defaults to true.
-    //
-    private var redirect = true
+    private class Configuration {
+        //
+        // If a file is not found, the given extensions will be added to the file name and searched for. The first that exists will be served. Example: ['html', 'htm'].
+        //
+        private var possibleExtensions = [String]()
+
+        //
+        // Serve "index.html" files in response to a request on a directory.  Defaults to true.
+        //
+        private var serveIndexForDirectory = true
+
+        //
+        // Uses the file system's last modified value.  Defaults to true.
+        //
+        private var addLastModifiedHeader = true
+
+        //
+        // Value of max-age in Cache-Control header.  Defaults to 0.
+        //
+        private var maxAgeCacheControlHeader = 0
+
+        //
+        // Redirect to trailing "/" when the pathname is a dir. Defaults to true.
+        //
+        private var redirect = true
+
+        //
+        // Generate ETag. Defaults to true.
+        //
+        private var generateETag = true
+    }
+
+    //
+    // configuration
+    //
+    private let configuration = Configuration()
+
 
     //
     // A setter for custom response headers.
     //
     private var customResponseHeadersSetter: ResponseHeadersSetter?
-
-    //
-    // Generate ETag. Defaults to true.
-    //
-    private var generateETag = true
-
-
 
     private var path: String
 

    }

    private func tryToServeWithExtensions(_ filePath: String, response: RouterResponse) {
        let filePathWithPossibleExtensions = possibleExtensions.map { filePath + "." + $0 }
        for filePathWithExtension in filePathWithPossibleExtensions {
            let fileManager = NSFileManager()
            var isDirectory = ObjCBool(false)

        for option in options {
            switch option {
            case .possibleExtensions(let value):
                configuration.possibleExtensions = value
            case .serveIndexForDir(let value):
                configuration.serveIndexForDirectory = value
            case .addLastModifiedHeader(let value):
                configuration.addLastModifiedHeader = value
            case .maxAgeCacheControlHeader(let value):
                configuration.maxAgeCacheControlHeader = value
            case .redirect(let value):
                configuration.redirect = value
            case .customResponseHeadersSetter(let value):
                customResponseHeadersSetter = value
            case .generateETag (let value):
                configuration.generateETag = value
            }
        }
    }
