restructured algorithm chain