Adding better memory management.