optimizations and glitches