added more ranking logic