CMake tweaks
Refactor out statistic event handling
Minor cleanup