Small modification to make use of the middleware.
JSLint friendly...