Changing database to not store intermediate files.
Mostly updated to new DB model.