(BROKEN, DO-NOT-USE) Add statistics calculator; refactoring checkpoint
Major refactoring. Separated IO from analyze as much as possible.