Sorting works I think, hopefully no bugs