Made the sorting thing work