updated the stack code