you can also here preallocate rather than using a list and then an array.