scan the array