Better handling of custom templates and hooks.
Bug fixes.

6 files changed