replaced memory access with load and store