Add new functionality to get proper selected table