WIP on stat specs
Fix sort and refactor complexity
Stat wip
Merge from master
Mg stat from master
Fix syntax
merge good copy from master'
'
Merge from dev