added storing and loading memory + allocation