added toArray method