Implement pipeline stage manager described in #4050
Implement pipeline stage manager described in #4050