shouldn't we append to the array and not create it anew each time?