Table manipulations and selection

These are from #634 .