Implemented StateStack class