improved table generator helper