Sorting table functionality and improvements to searching functions