abstraction for stacks