table logic on the run