implement range in Mem_store with a cursor over the map
some accompanying refactoring