Global and module hooks

Fixes #69
Fixes #70
Modify this accordingly. Also needs an example using both.