Table manipulations and selection

From #637.