Clubs and sets of ordinals closed under a function: problems in understanding a proof. I am having problems in understanding the outlined proof of a result relating clubs on an uncountable regular cardinal $\kappa$ and those we defined, given a function $f:\kappa^n\rightarrow\kappa$, as $C(f)=\{\alpha<\kappa\mid\forall\ \beta_1,...,\beta_n\in\alpha\quad  f(\beta_1,...,\beta_n)\in \alpha\}$.
Here I post a photo of the proof highlighting the passages I did not understand, basically everything except the intuitive idea, sadly.

I am completely clueless, so any help would be very useful.
 A: 
Closure of $\mathbf{C}(f)$ in $\kappa$ is immediate (since $f$ is finitary). 

Suppose $X\subseteq \mathbf{C}(f)$ with $\alpha = \sup X < \kappa$. We want to show $\alpha\in \mathbf{C}(f)$. So let $\beta_1,\dots,\beta_n\in \alpha$. For each $1\leq i \leq n$, there is some $\alpha_i\in X$ such that $\beta_i\in \alpha_i$. Let $\alpha_*$ be the maximum of the $\alpha_i$. In particular, $\alpha_*\in \mathbf{C}(f)$, so and $\beta_i\in \alpha_*$ for all $i$, so $f(b_1,\dots,b_n)\in \alpha_*\subseteq \alpha$, and hence $\alpha\in \mathbf{C}(f)$. 

By assumption on $\kappa$, one has that $|\{f(\beta_1,\dots,\beta_n)\mid \beta_1\dots,\beta_n\in \gamma_i\}|\leq |\gamma_i|^n < \kappa$. 

The first inequality is clear, since $f$ is a surjection $\gamma_i^n\to \{f(\beta_1,\dots,\beta_n)\mid \beta_1\dots,\beta_n\in \gamma_i\}$. For the second inequality, if $\gamma_i$ is infinite, then $|\gamma_i|^n = |\gamma_i| < \kappa$, since $\kappa$ is a cardinal and $\gamma_i<\kappa$. If $\gamma_i$ is finite, then $|\gamma_i|^n$ is finite, so it is less than $\kappa$. 
Note that we didn't actually use the regularity and uncountability of $\kappa$ here - yet! But now the point is that we define $\gamma_{i+1} = \sup \{f(\beta_1,\dots,\beta_n)\mid \beta_1\dots,\beta_n\in \gamma_i\}$. This is a supremum of a set of size less than $\kappa$, so since $\kappa$ is regular, $\gamma_{i+1}<\kappa$. And since $\kappa$ is regular and uncountable, $\sup_{i<\omega} \gamma_i < \kappa$. 

If $\gamma$ is closed under $f$, then $\gamma$ is limit and $\sup(C\cap \gamma) = \gamma$, and so $\gamma\in C$. 

Suppose that $\gamma = \alpha+1$ is a successor and closed under $f$. Then $\alpha\in \gamma$, so $f(\alpha) \in \gamma$, but $\alpha<f(\alpha)$, contradiction. So $\gamma$ is limit (or possibly $0$ - really the definition of $\mathbf{C}(f)$ should exclude $0$ to make the statement true, since $0$ is closed under every $n$-ary function, for $n>0$, but not every club contains $0$). 
Clearly $\sup(C\cap \gamma)\leq \gamma$. For the other direction, let $\alpha\in \gamma$. Then $a<f(\alpha)\in C\cap \gamma$, so $\alpha<\sup(C\cap \gamma)$, and hence $\gamma\leq \sup(C\cap \gamma)$. 
