edit for arbitrary order of table columns