Removed unused code, reduced warnings. + statistics