Add optimizations to QueryCount

You can now enable/disable the query, so it will not run if it is off-
screen, for example.