Allow metadata hooks

Fixes #1