little cleanup + nested toArray