Stats implementation

Implementation of statistics component (still buggy, fix will come very
soon).