memory use improvements