Fix map, refactor