Stack functions simplified