Updating to add a simple moving average example and also fixing the return value
correctly