some changes related to sorting, doesnt work ATM