Refactored stack as an two-tier data-indexed stack.