Start with the table each time with only the core rows, i.e. before adding the rows, delete the previously added rows. You will then only have the number of rows defined in your array.