added indices. fixed clearing of table.