 	host = config.basePath ? "#{req.protocol}://#{req.header 'host'}"
 	versionNumber = packageList?[req.params[0]]?.packageinformation?.version[0]
 	unless versionNumber?
-		res.send 404, '404 Not Found'
+		res.status(404).send '404 Not Found'
 		return
 	res.redirect 301, "#{host}/#{req.params[0]}/#{versionNumber.toLowerCase().replace (new RegExp ' ', 'g'), '_'}"
 

askForCredentials = (req, res) ->
	res.type 'txt'
	res.setHeader 'WWW-Authenticate', 'Basic realm="Please provide proper username and password to access this package"'
	res.send 401, 'Please provide proper username and password to access this package'
	
app.all '/', (req, res) ->
	callback = (username) ->

		do writer.endElement
		do writer.endDocument
		res.setHeader 'Last-Modified', lastUpdate.toUTCString()
		res.status(200).send (do writer.toString).replace /\{\{packageServerHost\}\}/g, host
	
	checkAuth req, res, callback

