Refactored quiz code.