first implementation of memory