Fix syntax and add hooks