Major change to sm.pl and sm.sh