implement and test mov-avg function