Add requireExactQuery setting and clean up the JS code a bit