sort and delete