Move toArray() to helpers