Updated search to take different sorting methods