use immutable stack