attempted fix at sorting