Stat app refactored a little