Added sort controls and implemented basic sorting for searching and browsing, including tests.