moved stats insided the lamda to forestall problems with multicore running