better iteration over array