Fix score tree function. And make test more sophisticated