Remove unnecessary toArray() call