revise stack implementation