A little additional cleanup to cut down on the number of dependencies. Still requires SPM functions and write_csv, but hopefully that's it now.