Edits to spm code