Bayesian hierarchical model - product of exponentials proportional to...? I'm reading through chapter 12 of Statistical Machine Learning and came upon this series of equations. I don't understand how the transformation from equation 12.77 to 12.78 happens. Can someone shed some light on it?

http://www.stat.cmu.edu/~larry/=sml/Bayes.pdf
 A: Note that expanding the quatratic term we have
$$
\begin{align}
f(\mu|\text{rest}) & =  \prod_i \exp\left(-\frac12 \psi_i^2 + \psi_i\mu -\frac{1}{2}\mu^2\right)\\
& = \prod_i \exp\left(-\frac12 \psi_i^2 \right)   \prod_i \exp\left(\psi_i\mu -\frac{1}{2}\mu^2\right)\\
\end{align}
$$
Since we are interested in $f$ as a function of $\mu$, upto maintaing proportionality,  we can drop the first term which is entirely in $\psi_i$, 
$$
\begin{align}
f(\mu|\text{rest}) & \propto  \prod_i \exp\left(\psi_i\mu -\frac{1}{2}\mu^2\right)\\
& = \exp\left(\sum_i \left(\psi_i\mu  - \frac12 \mu^2\right)\right) \\
& = \exp \left( \mu \sum_i \psi_i - \frac{k}{2}\mu^2\right).
\end{align}
$$
Letting $b = \frac1k\sum_i \psi_i$, we have
$$
\begin{align}
f(\mu|\text{rest}) & \propto   \exp \left( k\mu b - \frac{k}{2}\mu^2\right).
\end{align}
$$
Again relying on the fact that we are doing calculations up to proportionality, and given that $b$ is not dependent on $\mu$ we can include an additional term in $b^2$ without effect
$$
\begin{align}
f(\mu|\text{rest}) & \propto   \exp \left( -\frac{k}{2} b^2 + k\mu b - \frac{k}{2}\mu^2\right) \\
& = \exp \left(-\frac{k}{2} \left(b^2 - 2b \mu + \mu^2 \right) \right) \\
& = \exp \left(-\frac{k}{2} \left(b - \mu \right)^2 \right).
\end{align}
$$
