using more array iteration