refactor of MapWrapper