Improved statistics calculation