Cleanup hooks

* Explicit return value is not needed since 1.22, I11deb2117f.
* Type hint parameters to fail fast if assumptions are not met.

Change-Id: Ie234fc8574ced4785cb035d83a7af8ade468f4b1