implement more fine-tuning options for stats code