implemented moving averages