Added unit tests for rev-diff sort and some minor changes