Hygiene: Make hook code readable

There is so much confusion in this function.

Change-Id: I60802eb458dc9dd03ea976315fc90053fda27a52
(cherry picked from commit 88212c3766c431b16150e8dbe92132fc4a4cc132)