Various fixes and improvements to class flags

Fixes a couple of bugs (resolves #1211), adds class flag creation/modification time and scheduling status (resolves #1137), and improves query performance.
Can you mention here that the documentation for the this json is documented on the ```classflags()``` method? And on that method, can you wrap the docstring to a shorter number of characters. Right now they are one long line, which is hard to read / when I scrolled past it the first time I didn't even realize the json format was being documented there.