Add a new toArray method