Added functional tournament tree building part