averaging script change