Added $with_hooks argument