update the way to traverse array