useless sort conditions removed, deprecated functions erased