Improve the averaging
Updated from new averaging