Table manipulations and selection

All this module is from #637 .