added compute_stats