condensing sorting into one function, which isn't buggy anymore
:
;
'