Refactor. Removed path, assuming the middleware gets mounted to the proper path. Add more comments and whitespace.