Improved sort_by_columns