Applied latest changes to the dateByRank algorithm. Fixes all unit tests.