made it iterate over arrays of words