stability, stats improvements, tests and removing unused code.