new method of sorting table