added array traversing