Major refactoring. The code is a lot cleaner now: stats is refactored into a Stat object, file utils are in their own file now, and the node ringbuffer is also refactored into a ringbuffer object.