memory management improvements