As we are updating the memory every 3es than the memory is not passed to state, now instead pass once when updating mem and fetch if not updating.