Reworked searchbar result sorting, made a file for general helper
functions (might be useful in the long run, or it might not).