Table sort upgrade

Fixes #4