another optimization for memory