revise stack push/pop, integrate as solution