replace max_element into min_element
draw() now loops using iterator