separate hooks code