added code to add indexes when the table is requested.