Added command line options
Added AFFINITY flag
Fixed typedefs
Rebuild of stats