before refactoring
tournament version