ranking algorithm - not tested yet
fixed conflict