Memory management improvements