add documentation for stats and reorganize