Improve hooks handling.

Allows to register onto sub-hooks, for instance for songs.
Add tests for utils.