first iteration of ranking ALGORITHM