Debug hooks

Improving testability / adding acceptance tests