Changing the format of my table into a 1D array and reworking the table generation