add sort and elimination