130612w 14:51 - done (take2) for lib/middleware.js