toArray operation implemented