add memory functionality