add version of stackcollapse that reverses stacks