Watch out for the empty array case.