Implemented function rankall()