working towards a good sorting function
ok so now this is amazing