refactor hook matching, move logic to server side, reduce bandwidth