Rework the stack, not finished completely