Iterating the array form the beginning