Stable version with statistics

Some features missing, mostly done and working well.