added FlexibleTripleStack class for 3.1