memory-friendly improvements