Format code and refactor MapIterator