Improve statistics

To enable per-community statistics + some cleanup.