Making toArray method work. Yay!