improved table selection