committing the new code for sorting table (asc and desc way)