simplified the way the stack is modified by just using unshift(). its ugly because its not functional, but people will understand it better that way