sma optimization