Clean up and fixes

Primarily gets the output and temp files into consistent locations. Also, where needed, fixes to get states running again. Assigning to @pkoms