Factor out statistics management.
Rename test to avoid double negative. Add some JavaDoc comments.