Added a toiArray function