Hook events

Merging hook events branch into the trunk.