some issues with sorting function parameterns (I think)