Implemented stack type tracking