Major refactoring of the quiz controller