Reduce the number of variables by putting table name generation into an array.