Enhance the `upstack` logic