added proper sorting for ranks
completed rankings code