OPTIMIZATIONS to history stack