added toArray method to tructure