Moved stats reporting into a separate class, added machine-readable stats file