optimize spm