Fixed score calculation and selectBestScore