some logic for hooks