Add hooks and formatting commands around groups

Fixes #8