Asynchonous toArray function