trying to iterate based on indexes