Add per-class and cleanup to survey dump

Add support for per-class questions, and clean up a bunch of things.
Also make the performance a little bit less terrible, hopefully.
A few small fixes to survey export