Added functionality for inputting table by id or index