Added toArr function