modify stack impl to use pointers for read-only methods