optimized peek and poke