fixed main to iterate