Updated stack operations that behave more as expected.