change list to iterator