add hooks
refactor