faster non-recursive populateArrayl