Removed unused code
Added tests for stats