Thanks a lot for the proposed implementation of compareOrder. I had an occurrence on which the inilial implementation was running for an infinite time (more or less 1 minute). Your implementation is quite immediate with no change in results.