FlexSTP refactor