refactor middleware wrapping into using `default-middleware`, see #129