Implemented sorting for all columns in both ascending and descending orders.