gen_hooks, matric_crafter and hooks.c modifications