Extract higher-order function to filter tag handlers