added moving avg function inprog