 		config = @config
 		server = null
 
+		# Error Handling Stuff
+		errorFiles = {}
+		# read the out directory for available files
+		fileList = fsUtil.readdirSync(config.outPath)
+
+		for file in fileList
+			if file.match /^[0-9x]{3}\.html/
+				code = file.match /^([0-9x]{3})\.html/
+				errorFiles[code[1]] = pathUtil.join(config.outPath, file)
+
+		# Find the closest matching error page
+		findClosest = (code) ->
+			code = code.toString()
+			match = null
+			count = 2
+
+			while match == null
+				if errorFiles.hasOwnProperty(code)
+					match = code
+				else
+					code = code.substr(0, count)
+					while code.length < 3
+						code += 'x'
+					count -= 1
+			return match
+
 		# Handlers
 		complete = (err) ->
 			return next(err)  if err

							server.use(express.static config.outPath)

						# 404 Middleware
						server.use (req,res,next) ->
							if config.customErrors
								return next()
							return res.send(404)

				# Start the Server
				startServer()


# Necessary
pathUtil = require('path')
fsUtil = require('fs')
_ = require('underscore')
caterpillar = require('caterpillar')
CSON = require('cson')
