separated stats logic from server