spm preproc fixes and adds

A few changes here. Hopefully the commit comments make it clear what's going on.