Discard changes rewrite.

STUD-1860

@andy-armstrong and @benmcmorran Please review.

My sandbox has the final version of this. http://studio.cahrens.m.sandbox.edx.org/
Thanks for doing this!