added sma; updated arguments