replace map by upto iterator