As someone noodling with a stat trainer myself, seeing the behind the scenes dev logs here about the problems you face and the solutions you come up with has been very enlightening.