Move all private funs under private header
Add index_fail stat, remove pending stat

Add an index_fail stat.  While adding this new stat I also added tests
for the pending stat and found negative values for the count.  After
struggling with it for a while I decided the pending count is more
trouble then it's worth at the moment.  There may be other ways this
can be done if it is absolutely needed.