factored out the parsing in the middleware and brought it down to find()