Improve toArray a bit