Initial refactoring to a single middleware based pipeline

Minor tweak