adding iterator code