add funcion to calc rank for each side