updating stack processing logic