moved stats counter into sub