Automatic table sorting (fixed typo)